﻿using System;
using System.Collections.Generic;
using System.Text;
using Young3.FMSearch.Business.Managers;
using Young3.FMSearch.Business.Offsets;
using System.Linq;

namespace Young3.FMSearch.Business.Entities.InGame
{
    public class Weather : BaseObject
    {
        public Weather(int memoryAddress)
            : base(memoryAddress)
        { }

        public string Name
        {
            get { return ProcessManager.ReadString(MemoryAddress + WeatherOffsets.Name, null); }
        }

        public SpringWeather Spring
        {
            get { return new SpringWeather(MemoryAddress); }
        }

        public SummerWeather Summer
        {
            get { return new SummerWeather(MemoryAddress); }
        }

        public AutomnWeather Automn
        {
            get { return new AutomnWeather(MemoryAddress); }
        }

        public WinterWeather Winter
        {
            get { return new WinterWeather(MemoryAddress); }
        }

        public override string ToString()
        {
            return Name;
        }
    }

    public class SpringWeather : BaseObject
    {
        public SpringWeather(int memoryAddress)
            : base(memoryAddress)
        { }

        public int StartingDay
        {
            get { return ProcessManager.ReadInt16(MemoryAddress + WeatherOffsets.SpringStart); }
            set { ProcessManager.WriteInt16(value, MemoryAddress + WeatherOffsets.SpringStart); }
        }

        public Precipitation Precipitation
        {
            get { return new Precipitation(MemoryAddress + WeatherOffsets.SpringStart); }
        }

        public Wind Wind
        {
            get { return new Wind(MemoryAddress + WeatherOffsets.SpringStart); }
        }

        public Temperature Temperature
        {
            get { return new Temperature(MemoryAddress + WeatherOffsets.SpringStart); }
        }
    }

    public class SummerWeather : BaseObject
    {
        public SummerWeather(int memoryAddress)
            : base(memoryAddress)
        { }

        public int StartingDay
        {
            get { return ProcessManager.ReadInt16(MemoryAddress + WeatherOffsets.SummerStart); }
            set { ProcessManager.WriteInt16(value, MemoryAddress + WeatherOffsets.SummerStart); }
        }

        public Precipitation Precipitation
        {
            get { return new Precipitation(MemoryAddress + WeatherOffsets.SummerStart); }
        }

        public Wind Wind
        {
            get { return new Wind(MemoryAddress + WeatherOffsets.SummerStart); }
        }

        public Temperature Temperature
        {
            get { return new Temperature(MemoryAddress + WeatherOffsets.SummerStart); }
        }
    }

    public class AutomnWeather : BaseObject
    {
        public AutomnWeather(int memoryAddress)
            : base(memoryAddress)
        { }

        public int StartingDay
        {
            get { return ProcessManager.ReadInt16(MemoryAddress + WeatherOffsets.AutomnStart); }
            set { ProcessManager.WriteInt16(value, MemoryAddress + WeatherOffsets.AutomnStart); }
        }

        public Precipitation Precipitation
        {
            get { return new Precipitation(MemoryAddress + WeatherOffsets.AutomnStart); }
        }

        public Wind Wind
        {
            get { return new Wind(MemoryAddress + WeatherOffsets.AutomnStart); }
        }

        public Temperature Temperature
        {
            get { return new Temperature(MemoryAddress + WeatherOffsets.AutomnStart); }
        }
    }

    public class WinterWeather : BaseObject
    {
        public WinterWeather(int memoryAddress)
            : base(memoryAddress)
        { }

        public int StartingDay
        {
            get { return ProcessManager.ReadInt16(MemoryAddress + WeatherOffsets.WinterStart); }
            set { ProcessManager.WriteInt16(value, MemoryAddress + WeatherOffsets.WinterStart); }
        }

        public Precipitation Precipitation
        {
            get { return new Precipitation(MemoryAddress + WeatherOffsets.WinterStart); }
        }

        public Wind Wind
        {
            get { return new Wind(MemoryAddress + WeatherOffsets.WinterStart); }
        }

        public Temperature Temperature
        {
            get { return new Temperature(MemoryAddress + WeatherOffsets.WinterStart); }
        }
    }

    public class Temperature : BaseObject
    {
        public Temperature(int memoryAddress)
            : base(memoryAddress)
        { }

        public byte Freezing
        {
            get { return ProcessManager.ReadByte(MemoryAddress + WeatherOffsets.TemperatureFreezing); }
            set { ProcessManager.WriteByte(value, MemoryAddress + WeatherOffsets.TemperatureFreezing); }
        }

        public byte Cold
        {
            get { return ProcessManager.ReadByte(MemoryAddress + WeatherOffsets.TemperatureCold); }
            set { ProcessManager.WriteByte(value, MemoryAddress + WeatherOffsets.TemperatureCold); }
        }

        public byte Mild
        {
            get { return ProcessManager.ReadByte(MemoryAddress + WeatherOffsets.TemperatureMild); }
            set { ProcessManager.WriteByte(value, MemoryAddress + WeatherOffsets.TemperatureMild); }
        }

        public byte Fine
        {
            get { return ProcessManager.ReadByte(MemoryAddress + WeatherOffsets.TemperatureFine); }
            set { ProcessManager.WriteByte(value, MemoryAddress + WeatherOffsets.TemperatureFine); }
        }

        public byte Warm
        {
            get { return ProcessManager.ReadByte(MemoryAddress + WeatherOffsets.TemperatureWarm); }
            set { ProcessManager.WriteByte(value, MemoryAddress + WeatherOffsets.TemperatureWarm); }
        }

        public byte Hot
        {
            get { return ProcessManager.ReadByte(MemoryAddress + WeatherOffsets.TemperatureHot); }
            set { ProcessManager.WriteByte(value, MemoryAddress + WeatherOffsets.TemperatureHot); }
        }

        public byte VeryHot
        {
            get { return ProcessManager.ReadByte(MemoryAddress + WeatherOffsets.TemperatureVeryHot); }
            set { ProcessManager.WriteByte(value, MemoryAddress + WeatherOffsets.TemperatureVeryHot); }
        }
    }

    public class Wind : BaseObject
    {
        public Wind(int memoryAddress)
            : base(memoryAddress)
        { }

        public byte Calm
        {
            get { return ProcessManager.ReadByte(MemoryAddress + WeatherOffsets.WindCalm); }
            set { ProcessManager.WriteByte(value, MemoryAddress + WeatherOffsets.WindCalm); }
        }

        public byte Breezy
        {
            get { return ProcessManager.ReadByte(MemoryAddress + WeatherOffsets.WindBreezy); }
            set { ProcessManager.WriteByte(value, MemoryAddress + WeatherOffsets.WindBreezy); }
        }

        public byte Gusty
        {
            get { return ProcessManager.ReadByte(MemoryAddress + WeatherOffsets.WindGusty); }
            set { ProcessManager.WriteByte(value, MemoryAddress + WeatherOffsets.WindGusty); }
        }

        public byte Strong
        {
            get { return ProcessManager.ReadByte(MemoryAddress + WeatherOffsets.WindStrong); }
            set { ProcessManager.WriteByte(value, MemoryAddress + WeatherOffsets.WindStrong); }
        }

        public byte Gale
        {
            get { return ProcessManager.ReadByte(MemoryAddress + WeatherOffsets.WindGale); }
            set { ProcessManager.WriteByte(value, MemoryAddress + WeatherOffsets.WindGale); }
        }
    }

    public class Precipitation : BaseObject
    {
        public Precipitation(int memoryAddress)
            : base(memoryAddress)
        { }

        public byte Dry
        {
            get { return ProcessManager.ReadByte(MemoryAddress + WeatherOffsets.PrecipitationDry); }
            set { ProcessManager.WriteByte(value, MemoryAddress + WeatherOffsets.PrecipitationDry); }
        }

        public byte Wet
        {
            get { return ProcessManager.ReadByte(MemoryAddress + WeatherOffsets.PrecipitationWet); }
            set { ProcessManager.WriteByte(value, MemoryAddress + WeatherOffsets.PrecipitationWet); }
        }

        public byte Drizzle
        {
            get { return ProcessManager.ReadByte(MemoryAddress + WeatherOffsets.PrecipitationDrizzle); }
            set { ProcessManager.WriteByte(value, MemoryAddress + WeatherOffsets.PrecipitationDrizzle); }
        }

        public byte Shower
        {
            get { return ProcessManager.ReadByte(MemoryAddress + WeatherOffsets.PrecipitationShower); }
            set { ProcessManager.WriteByte(value, MemoryAddress + WeatherOffsets.PrecipitationShower); }
        }

        public byte DownPour
        {
            get { return ProcessManager.ReadByte(MemoryAddress + WeatherOffsets.PrecipitationDownPour); }
            set { ProcessManager.WriteByte(value, MemoryAddress + WeatherOffsets.PrecipitationDownPour); }
        }
    }
}